package org.example;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

/**
 * @BelongsProject: springboot3
 * @BelongsPackage: org.example
 * @Author: guodf
 * @CreateTime: 2024-01-30  17:21
 * @Description: 原生创建rabbitmq连接
 * @Version: 1.0.0
 */
public class RabbitMqUtils {

    public static Channel getChannel() throws Exception {
        ConnectionFactory connectionFactory = new ConnectionFactory();
        connectionFactory.setHost("101.200.130.254");
        connectionFactory.setPort(5672);
        connectionFactory.setUsername("guest");
        connectionFactory.setPassword("gdf254691");
        Connection connection = connectionFactory.newConnection();
        return connection.createChannel();
    }
}
